home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
TURB_VIS
/
PGC122
/
BBDLG.PAS
next >
Wrap
Pascal/Delphi Source File
|
1994-02-09
|
24KB
|
211 lines
(* This file was mangled by Mangler 1.14 (c) Copyright 1993 by Berend de Boer *)
{$IFDEF DPMI} {$X+,S-,I-,V-} {$ELSE} {$X+,O+,F+,I-,R-,Q-,S-,V-,D-} {$ENDIF} UNIT BBDLG ;INTERFACE USES OBJECTS ,
DRIVERS , MENUS , VIEWS , DIALOGS ;CONST MFWARNING =$0000 ;MFERROR =$0001 ;MFINFORMATION =$0002 ;MFCONFIRMATION =$0003 ;
MFYESBUTTON =$0100 ;MFNOBUTTON =$0200 ;MFOKBUTTON =$0400 ;MFCANCELBUTTON =$0800 ;MFHELPBUTTON =$1000 ;
MFYESNOCANCEL =MFYESBUTTON + MFNOBUTTON + MFCANCELBUTTON ;MFOKCANCEL =MFOKBUTTON + MFCANCELBUTTON ;
MFOKCANCELHELP =MFOKBUTTON + MFCANCELBUTTON + MFHELPBUTTON ;CONST PASSWORDLEN =8 ;CONST NUMBERS ='0123456789';
CAPITALS ='ABCDEFGHIJKLMNOPQRSTUVWXYZ';LOWERCASE ='abcdefghijklmnopqrstuvwxyz';ALLCHARS ='';CONST CMEDITITEM =240 ;
CMDELETEITEM =241 ;CMINSERTITEM =242 ;CMBEDITITEM =243 ;CMBDELETEITEM =244 ;CMBINSERTITEM =245 ;CONST ENGLISH =0 ;
DUTCH =0 ;CONST YES =CMYES ;NO =CMNO ;CANCEL =CMCANCEL ;TYPE PPOPUPMENU =^TPOPUPMENU ;
TPOPUPMENU =OBJECT (TMENUPOPUP)DESTRUCTOR DONE ;VIRTUAL;END ;PSPINBUTTON =^TSPINBUTTON ;
TSPINBUTTON =OBJECT (TRADIOBUTTONS)CONSTRUCTOR INIT (VAR BOUNDS :TRECT ;ASTRINGS :PSITEM );PROCEDURE DRAW ;VIRTUAL;
PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;END ;PXINPUTLINE =^TXINPUTLINE ;
TXINPUTLINE =OBJECT (TINPUTLINE)PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;END ;PLISTVIEWER2 =^TLISTVIEWER2 ;
TLISTVIEWER2 =OBJECT (TLISTVIEWER)TYPEDSTR :PSTRING ;TYPEDSTRINDEX :WORD ;CONSTRUCTOR INIT (VAR BOUNDS :TRECT ;
ANUMCOLS :INTEGER ;AHSCROLLBAR ,AVSCROLLBAR:PSCROLLBAR );PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;
PROCEDURE INSERTITEM ;VIRTUAL;PROCEDURE DELETEITEM ;VIRTUAL;PROCEDURE EDITITEM ;VIRTUAL;END ;
TLISTBOXREC =RECORD LIST :PCOLLECTION ;SELECTION :WORD ;END ;PLISTBOX2 =^TLISTBOX2 ;
TLISTBOX2 =OBJECT (TLISTBOX)TYPEDSTR :PSTRING ;TYPEDSTRINDEX :WORD ;CONSTRUCTOR INIT (VAR BOUNDS :TRECT ;
ANUMCOLS :INTEGER ;AVSCROLLBAR :PSCROLLBAR );PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;PROCEDURE INSERTITEM ;
VIRTUAL;PROCEDURE DELETEITEM ;VIRTUAL;PROCEDURE EDITITEM ;VIRTUAL;END ;PPARAMINPUTBOX =^TPARAMINPUTBOX ;
TPARAMINPUTBOX =OBJECT (TLISTBOX2)PROCEDURE INSERTITEM ;VIRTUAL;PROCEDURE DELETEITEM ;VIRTUAL;PROCEDURE EDITITEM ;
VIRTUAL;END ;PSTRINGINPUTBOX =^TSTRINGINPUTBOX ;TSTRINGINPUTBOX =OBJECT (TLISTBOX2)PROCEDURE INSERTITEM ;VIRTUAL;
PROCEDURE DELETEITEM ;VIRTUAL;PROCEDURE EDITITEM ;VIRTUAL;END ;PROCEDURE DISPOSESITEM (PS :PSITEM );PROCEDURE PRINTERROR
(CONST S :STRING ;AHELPCTX :WORD );PROCEDURE PRINTWARNING (CONST S :STRING ;AHELPCTX :WORD );FUNCTION PROMPTUSER
(CONST S :STRING ;AHELPCTX :WORD ):WORD ;FUNCTION USERANSWER (CONST S :STRING ;AHELPCTX :WORD ):WORD ;FUNCTION POPANSWER
(CONST S :STRING ;AHELPCTX :WORD ):WORD ;FUNCTION INPUTSTRING (HEADER :STRING ;VAR S :STRING ;LEN :WORD ;
ALLOWEDCHARS :STRING ;AHELPCTX :WORD ):WORD ;FUNCTION INPUTWORD (HEADER :STRING ;VAR W :WORD ;LEN :WORD ;
AHELPCTX :WORD ):WORD ;PROCEDURE INFOBOX (CONST S :STRING ;AHELPCTX :WORD );FUNCTION EXECDIALOG (P :PDIALOG ;
DATA :POINTER ):WORD ;FUNCTION CHECKEXECDIALOG (P :PDIALOG ;DATA :POINTER ;DATASIZE :WORD ):WORD ;FUNCTION PASSWORD
(CONST S :STRING ;AHELPCTX :WORD ):BOOLEAN ;PROCEDURE INSERTBUTTONS (DIALOG :PDIALOG ;AOPTIONS :WORD );
PROCEDURE CREATESTATUSDLG (CONST ATITLE :TTITLESTR ;ATOTAL :LONGINT ;AHELPCTX :WORD );PROCEDURE DISPOSESTATUSDLG ;
PROCEDURE STATUSDLGSET (POSITION :LONGINT );PROCEDURE STATUSDLGNEWTEXT (CONST S :STRING );PROCEDURE SHOWHELPWINDOW
(CONST FILENAME :STRING ;HELPCTX :WORD );PROCEDURE VIEWASTEXT (CONST FILENAME :FNAMESTR );FUNCTION MESSAGEBOX
(CONST MSG :STRING ;PARAMS :POINTER ;AOPTIONS :WORD ;AHELPCTX :WORD ):WORD ;FUNCTION MESSAGEBOXRECT (VAR R :TRECT ;
CONST MSG :STRING ;PARAMS :POINTER ;AOPTIONS :WORD ;AHELPCTX :WORD ):WORD ;IMPLEMENTATION USES APP , HELPFILE , EDITORS ,
VIEWTEXT , BBGUI , BBUTIL , BBFILE , BBERROR , BBSTRRES ;{$I PREAPP.INC} CONST OOIOlO01OOI0=1000 ;OOIOO1OlO0Il=1001 ;
TYPE OI1O11O0II1=^OI1O11O0IO0;OI1O11O0IO0=OBJECT (TXINPUTLINE)O10OlIOO01O10:STRING ;CONSTRUCTOR INIT
(VAR O10O0OO1lIOO0:TRECT;OOII00O01010:INTEGER;O10OlIIIO0ll1:STRING );PROCEDURE HANDLEEVENT (VAR EVENT:TEVENT);VIRTUAL;
END ;O1010llIO1I10=^O1010llIO1I01;O1010llIO1I01=OBJECT (TINPUTLINE)PROCEDURE DRAW ;VIRTUAL;END ;
OI10O0OI011=^OI10O0OI00I;OI10O0OI00I=OBJECT (TVIEW)CONSTRUCTOR INIT (O10O0OO1lIOO0:TRECT);PROCEDURE DRAW ;VIRTUAL;
FUNCTION GETPALETTE :PPALETTE ;VIRTUAL;PROCEDURE UPDATE (OOIIOlIl00lO:WORD);FUNCTION VALID (OlIlOOOl0:WORD):BOOLEAN ;
VIRTUAL;PRIVATE O100lll0I1l:INTEGER;END ;OOO001lOO1OI=^OOO001lOO1IO;OOO001lOO1IO=OBJECT (TDIALOG)O100lll0I1l:INTEGER;
OI1I01OI0Ol:LONGINT;Ol010II0OOI0:PSTATICTEXT;OlI01Ol1I:OI10O0OI011;OOllI0II0lIO:PSTATICTEXT;CONSTRUCTOR INIT
(VAR O10O0OO1lIOO0:TRECT;OI110IO10Oll:TTITLESTR;OI11Oll000I:LONGINT);PROCEDURE SETPERC (O101OIl1l00IO:LONGINT);
PROCEDURE NEWTEXT (CONST OO1O:STRING );END ;CONST OOO000O0II0O:OOO001lOO1OI=NIL ;PROCEDURE DISPOSESITEM (PS:PSITEM);
BEGIN IF PS <> NIL THEN BEGIN DISPOSESITEM (PS ^. NEXT );DISPOSESTR (PS ^. VALUE );DISPOSE (PS );END ;END ;
FUNCTION MESSAGEBOX (CONST MSG:STRING ;PARAMS:POINTER;AOPTIONS:WORD;AHELPCTX:WORD):WORD ;VAR OO1I:TRECT;
BEGIN OO1I.ASSIGN (0 , 0 , 40 , 9 );OO1I.MOVE ((DESKTOP ^. SIZE.X - OO1I.B.X )DIV 2 , (DESKTOP ^. SIZE.Y - OO1I.B.Y )DIV
2 );MESSAGEBOX := MESSAGEBOXRECT (OO1I , MSG , PARAMS , AOPTIONS , AHELPCTX );END ;PROCEDURE INSERTBUTTONS
(DIALOG:PDIALOG;AOPTIONS:WORD);CONST O100l11l1IO01:ARRAY [ 0 .. 4 ] OF STRING [ 6 ] =('~Y~es', '~N~o', 'O~K~', 'Cancel',
'Help');CONST OOIIIlI0Il1O:ARRAY [ 0 .. 4 ] OF WORD=(CMYES, CMNO, CMOK, CMCANCEL, CMHELP);
VAR OIlO,OOIO,O10OO0Il0OIl0:INTEGER;OO1000011:PVIEW;OO1I:TRECT;OOO0OlOI0lIl:ARRAY [ 0 .. 4 ] OF PVIEW;
BEGIN WITH DIALOG^ DO BEGIN OOIO := - 2 ;O10OO0Il0OIl0 := 0 ;FOR OIlO := 0 TO 4 DO IF AOPTIONS AND ($0100 SHL OIlO )<> 0
THEN BEGIN OO1I.ASSIGN (0 , 0 , 10 , 2 );IF OIlO IN [ 0 , 2 ] THEN BEGIN IF STRINGS =NIL THEN OO1000011 := NEW (PBUTTON ,
INIT (OO1I , O100l11l1IO01 [ OIlO ] , OOIIIlI0Il1O [ OIlO ] , BFDEFAULT ))ELSE OO1000011 := NEW (PBUTTON , INIT (OO1I ,
RSGET (SBUTTONYES + OIlO ), OOIIIlI0Il1O [ OIlO ] , BFDEFAULT ));END ELSE BEGIN IF STRINGS =NIL THEN OO1000011 := NEW
(PBUTTON , INIT (OO1I , O100l11l1IO01 [ OIlO ] , OOIIIlI0Il1O [ OIlO ] , BFNORMAL ))ELSE OO1000011 := NEW (PBUTTON , INIT
(OO1I , RSGET (SBUTTONYES + OIlO ), OOIIIlI0Il1O [ OIlO ] , BFNORMAL ));END ;INC (OOIO , OO1000011 ^. SIZE.X + 2 );
OOO0OlOI0lIl [ O10OO0Il0OIl0 ] := OO1000011 ;INC (O10OO0Il0OIl0 );END ;OOIO := (SIZE.X - OOIO )SHR 1 ;FOR OIlO := 0 TO
O10OO0Il0OIl0 - 1 DO BEGIN OO1000011 := OOO0OlOI0lIl [ OIlO ] ;INSERT (OO1000011 );OO1000011 ^. MOVETO (OOIO , SIZE.Y -
3 );INC (OOIO , OO1000011 ^. SIZE.X + 2 );END ;SELECTNEXT (FALSE );END ;END ;FUNCTION MESSAGEBOXRECT (VAR R:TRECT;
CONST MSG:STRING ;PARAMS:POINTER;AOPTIONS:WORD;AHELPCTX:WORD):WORD ;CONST O10O0lIO1000I:ARRAY [ 0 .. 3 ] OF STRING [ 11
] =('Warning', 'Error', 'Information', 'Confirm');VAR O10OIIIOll1O1:PDIALOG;OO1000011:PVIEW;OO1O:STRING ;BEGIN IF STRINGS
=NIL THEN O10OIIIOll1O1 := NEW (PDIALOG , INIT (R , O10O0lIO1000I [ AOPTIONS AND $3 ] ))ELSE O10OIIIOll1O1 := NEW
(PDIALOG , INIT (R , RSGET (SWARNING + (AOPTIONS AND $3 ))));WITH O10OIIIOll1O1^ DO BEGIN R.ASSIGN (3 , 2 , SIZE.X - 2 ,
SIZE.Y - 3 );FORMATSTR (OO1O , MSG , PARAMS ^);OO1000011 := NEW (PSTATICTEXT , INIT (R , OO1O ));INSERT (OO1000011 );
INSERTBUTTONS (O10OIIIOll1O1 , AOPTIONS );END ;O10OIIIOll1O1 ^. HELPCTX := AHELPCTX ;MESSAGEBOXRECT := DESKTOP ^.
EXECVIEW (O10OIIIOll1O1 );DISPOSE (O10OIIIOll1O1 , DONE );END ;PROCEDURE PRINTERROR (CONST S:STRING ;AHELPCTX:WORD);
VAR O100llIl00IOl:WORD;BEGIN ASM {} MOV O100llIl00IOl, BP {} END;IF APPLICATION =NIL THEN BBGUI.TEXTPRINTERROR (S ,
AHELPCTX )ELSE BEGIN BEEP ;MESSAGEBOX (S , NIL , MFERROR + MFOKBUTTON , AHELPCTX );LOGERROR ('Error: '+ S );IF @
DUMPSTACK <> NIL THEN DUMPSTACK (NIL , O100llIl00IOl );END ;END ;PROCEDURE PRINTWARNING (CONST S:STRING ;AHELPCTX:WORD);
BEGIN IF APPLICATION =NIL THEN BBGUI.TEXTPRINTERROR (S , AHELPCTX )ELSE BEGIN BEEP ;MESSAGEBOX (S , NIL , MFWARNING +
MFOKBUTTON , AHELPCTX );LOGERROR ('Warning: '+ S );END ;END ;FUNCTION PROMPTUSER (CONST S:STRING ;AHELPCTX:WORD):WORD ;
BEGIN IF APPLICATION =NIL THEN BEGIN WRITELN (S );PROMPTUSER := CMYES ;END ELSE PROMPTUSER := MESSAGEBOX (S , NIL ,
MFINFORMATION + MFOKBUTTON , AHELPCTX );END ;FUNCTION USERANSWER (CONST S:STRING ;AHELPCTX:WORD):WORD ;BEGIN IF
APPLICATION =NIL THEN USERANSWER := TEXTUSERANSWER (S , AHELPCTX )ELSE USERANSWER := MESSAGEBOX (S , NIL , MFCONFIRMATION
+ MFYESNOCANCEL , AHELPCTX );END ;FUNCTION POPANSWER (CONST S:STRING ;AHELPCTX:WORD):WORD ;BEGIN POPANSWER := USERANSWER
(S , AHELPCTX );END ;CONSTRUCTOR OI1O11O0IO0.INIT (VAR O10O0OO1lIOO0:TRECT;OOII00O01010:INTEGER;O10OlIIIO0ll1:STRING );
BEGIN INHERITED INIT(O10O0OO1lIOO0 , OOII00O01010 );O10OlIOO01O10 := O10OlIIIO0ll1 ;END ;
PROCEDURE OI1O11O0IO0.HANDLEEVENT (VAR EVENT:TEVENT);BEGIN IF (O10OlIOO01O10 <> '')AND (EVENT.WHAT AND EVKEYBOARD <> 0
)AND (EVENT.CHARCODE IN [ #32.. #255] )THEN BEGIN IF POS (EVENT.CHARCODE , O10OlIOO01O10 )=0 THEN BEGIN EVENT.CHARCODE :=
UPCASE (EVENT.CHARCODE );IF POS (EVENT.CHARCODE , O10OlIOO01O10 )=0 THEN BEGIN CLEAREVENT (EVENT );BEEP ;END ;END ;END ;
INHERITED HANDLEEVENT(EVENT );END ;FUNCTION INPUTSTRING (HEADER:STRING ;VAR S:STRING ;LEN:WORD;ALLOWEDCHARS:STRING ;
AHELPCTX:WORD):WORD ;VAR OO1I:TRECT;O10OIIIOll1O1:PDIALOG;BEGIN OO1I.ASSIGN (0 , 0 , 40 , 7 );OO1I.MOVE ((DESKTOP ^.
SIZE.X - OO1I.B.X )DIV 2 , (DESKTOP ^. SIZE.Y - OO1I.B.Y )DIV 2 );O10OIIIOll1O1 := NEW (PDIALOG , INIT (OO1I , HEADER ));
O10OIIIOll1O1 ^. HELPCTX := AHELPCTX ;IF LEN < O10OIIIOll1O1 ^. SIZE.X - 1 THEN OO1I.ASSIGN (2 , 2 , 2 + 2 + LEN , 3
)ELSE OO1I.ASSIGN (2 , 2 , O10OIIIOll1O1 ^. SIZE.X - 2 , 3 );O10OIIIOll1O1 ^. INSERT (NEW (OI1O11O0II1 , INIT (OO1I , LEN
, ALLOWEDCHARS )));INSERTBUTTONS (O10OIIIOll1O1 , MFOKCANCELHELP );INPUTSTRING := EXECDIALOG (O10OIIIOll1O1 , @ S );
END ;FUNCTION INPUTWORD (HEADER:STRING ;VAR W:WORD;LEN:WORD;AHELPCTX:WORD):WORD ;VAR OO1O:STRING ;BEGIN OO1O := '';
INPUTWORD := INPUTSTRING (HEADER , OO1O , LEN , NUMBERS , AHELPCTX );W := VALW (OO1O );END ;PROCEDURE INFOBOX
(CONST S:STRING ;AHELPCTX:WORD);BEGIN IF APPLICATION =NIL THEN BBGUI.TEXTINFOBOX (S , AHELPCTX )ELSE MESSAGEBOX (S , NIL
, MFINFORMATION + MFOKBUTTON , AHELPCTX );END ;FUNCTION EXECDIALOG (P:PDIALOG;DATA:POINTER):WORD ;VAR OIO11IOOlO0:WORD;
BEGIN OIO11IOOlO0 := CMCANCEL ;P := PDIALOG (APPLICATION ^. VALIDVIEW (P ));IF P <> NIL THEN BEGIN IF DATA <> NIL THEN P
^. SETDATA (DATA ^);OIO11IOOlO0 := DESKTOP ^. EXECVIEW (P );IF (OIO11IOOlO0 <> CMCANCEL )AND (DATA <> NIL )THEN P ^.
GETDATA (DATA ^);DISPOSE (P , DONE );END ;EXECDIALOG := OIO11IOOlO0 ;END ;FUNCTION CHECKEXECDIALOG (P:PDIALOG;
DATA:POINTER;DATASIZE:WORD):WORD ;VAR OIO11IOOlO0:WORD;BEGIN OIO11IOOlO0 := CMCANCEL ;P := PDIALOG (APPLICATION ^.
VALIDVIEW (P ));IF P <> NIL THEN BEGIN IF DATA <> NIL THEN BEGIN IF P ^. DATASIZE <> DATASIZE THEN BEGIN PRINTERROR
('Internal error. DataSize mismatch -- CheckExecDialog --', HCNOCONTEXT );HALT (1 );END ;P ^. SETDATA (DATA ^);END ;
OIO11IOOlO0 := DESKTOP ^. EXECVIEW (P );IF (OIO11IOOlO0 <> CMCANCEL )AND (DATA <> NIL )THEN P ^. GETDATA (DATA ^);
DISPOSE (P , DONE );END ;CHECKEXECDIALOG := OIO11IOOlO0 ;END ;PROCEDURE O1010llIO1I01.DRAW ;VAR OO1O:STRING ;
OIlO:INTEGER;BEGIN OO1O := DATA ^;FOR OIlO := 1 TO LENGTH (OO1O ) DO DATA ^[ OIlO ] := '*';INHERITED DRAW;DATA ^:= OO1O ;
END ;FUNCTION PASSWORD (CONST S:STRING ;AHELPCTX:WORD):BOOLEAN ;VAR OO1I:TRECT;O10OIIIOll1O1:PDIALOG;O11l0IOI:STRING ;
OO10:PPALETTE;O1O11O0Illl,O1OI0l0I1I0:CHAR;BEGIN OO1I.ASSIGN (0 , 0 , 40 , 9 );OO1I.MOVE ((DESKTOP ^. SIZE.X - OO1I.B.X
)DIV 2 , (DESKTOP ^. SIZE.Y - OO1I.B.Y )DIV 2 );O10OIIIOll1O1 := NEW (PDIALOG , INIT (OO1I , RSGET (SPASSWORD )));
O10OIIIOll1O1 ^. HELPCTX := AHELPCTX ;OO1I.ASSIGN (2 , 2 , 39 , 3 );O10OIIIOll1O1 ^. INSERT (NEW (PSTATICTEXT , INIT
(OO1I , RSGET (SENTERPASSWORD ))));OO1I.ASSIGN (4 , 4 , 4 + 16 + 2 , 5 );O10OIIIOll1O1 ^. INSERT (NEW (O1010llIO1I10 ,
INIT (OO1I , PASSWORDLEN )));INSERTBUTTONS (O10OIIIOll1O1 , MFOKCANCEL );PBUTTON (O10OIIIOll1O1 ^. CURRENT ^. PREV )^.
AMDEFAULT := TRUE ;IF DESKTOP ^. EXECVIEW (O10OIIIOll1O1 )=CMCANCEL THEN PASSWORD := FALSE ELSE BEGIN O10OIIIOll1O1 ^.
GETDATA (O11l0IOI );IF UPSTR (O11l0IOI )=UPSTR (S )THEN PASSWORD := TRUE ELSE PASSWORD := FALSE ;END ;END ;
CONSTRUCTOR OI10O0OI00I.INIT (O10O0OO1lIOO0:TRECT);BEGIN INHERITED INIT(O10O0OO1lIOO0 );O100lll0I1l := 0 ;END ;
PROCEDURE OI10O0OI00I.DRAW ;VAR OOllOI000O1l:BYTE;OIlO:INTEGER;OIO1:TDRAWBUFFER;OIOI100IlI0:STRING ;
O1OlOIO0OOOO:INTEGER;BEGIN IF O100lll0I1l =100 THEN O1OlOIO0OOOO := SIZE.X ELSE O1OlOIO0OOOO := (O100lll0I1l * SIZE.X
)DIV 100 ;OIOI100IlI0 := REPCHAR (#177, SIZE.X );FOR OIlO := 1 TO SIZE.X DO BEGIN IF OIlO <= O1OlOIO0OOOO THEN
OOllOI000O1l := GETCOLOR (2 )ELSE OOllOI000O1l := GETCOLOR (1 );MOVECHAR (OIO1 [ OIlO - 1 ] , OIOI100IlI0 [ OIlO ] ,
OOllOI000O1l , 1 );END ;WRITEBUF (0 , 0 , SIZE.X , 1 , OIO1 );END ;FUNCTION OI10O0OI00I.GETPALETTE :PPALETTE ;
CONST OO10:STRING [ 2 ] =#19#20;BEGIN GETPALETTE := @ OO10 ;END ;PROCEDURE OI10O0OI00I.UPDATE (OOIIOlIl00lO:WORD);
BEGIN O100lll0I1l := OOIIOlIl00lO ;DRAWVIEW ;END ;FUNCTION OI10O0OI00I.VALID (OlIlOOOl0:WORD):BOOLEAN ;BEGIN IF OlIlOOOl0
=CMVALID THEN VALID := (SIZE.X >= 10 )AND (SIZE.Y =1 )ELSE VALID := INHERITED VALID(OlIlOOOl0 );END ;
CONSTRUCTOR OOO001lOO1IO.INIT (VAR O10O0OO1lIOO0:TRECT;OI110IO10Oll:TTITLESTR;OI11Oll000I:LONGINT);VAR OO1I:TRECT;
BEGIN INHERITED INIT(O10O0OO1lIOO0 , OI110IO10Oll );IF OI11Oll000I =0 THEN OI1I01OI0Ol := 1 ELSE OI1I01OI0Ol :=
OI11Oll000I ;OO1I.ASSIGN (SIZE.X - 4 - 4 , 3 , SIZE.X - 4 , 4 );O100lll0I1l := 0 ;Ol010II0OOI0 := NEW (PSTATICTEXT , INIT
(OO1I , ' 0%'));INSERT (Ol010II0OOI0 );OO1I.ASSIGN (4 , 4 , SIZE.X - 4 , 5 );OlI01Ol1I := NEW (OI10O0OI011 , INIT (OO1I
));INSERT (OlI01Ol1I );OO1I.ASSIGN (3 , 2 , SIZE.X - 3 , 3 );OOllI0II0lIO := NEW (PSTATICTEXT , INIT (OO1I , ''));END ;
PROCEDURE OOO001lOO1IO.SETPERC (O101OIl1l00IO:LONGINT);BEGIN LOCK ;FREESTR (Ol010II0OOI0 ^. TEXT );IF O101OIl1l00IO
=OI1I01OI0Ol THEN BEGIN Ol010II0OOI0 ^. TEXT := NEWSTR ('100%');O100lll0I1l := 100 ;END ELSE BEGIN Ol010II0OOI0 ^. TEXT
:= NEWSTR (' '+ STRW (O100lll0I1l )+ '%');O100lll0I1l := (O101OIl1l00IO * 100 )DIV OI1I01OI0Ol ;END ;OlI01Ol1I ^. UPDATE
(O100lll0I1l );REDRAW ;UNLOCK ;END ;PROCEDURE OOO001lOO1IO.NEWTEXT (CONST OO1O:STRING );BEGIN FREESTR (OOllI0II0lIO ^.
TEXT );OOllI0II0lIO ^. TEXT := NEWSTR (OO1O );OOllI0II0lIO ^. DRAW ;END ;PROCEDURE CREATESTATUSDLG
(CONST ATITLE:TTITLESTR;ATOTAL:LONGINT;AHELPCTX:WORD);VAR OO1I:TRECT;BEGIN IF APPLICATION <> NIL THEN BEGIN OO1I.ASSIGN
(0 , 0 , 40 , 8 );OO1I.MOVE ((DESKTOP ^. SIZE.X - OO1I.B.X )DIV 2 , (DESKTOP ^. SIZE.Y - OO1I.B.Y )DIV 2 );OOO000O0II0O
:= NEW (OOO001lOO1OI , INIT (OO1I , ATITLE , ATOTAL ));DESKTOP ^. INSERT (OOO000O0II0O );END ;END ;
PROCEDURE DISPOSESTATUSDLG ;BEGIN IF OOO000O0II0O <> NIL THEN BEGIN DESKTOP ^. DELETE (OOO000O0II0O );DISPOSE
(OOO000O0II0O , DONE );OOO000O0II0O := NIL ;END ;END ;PROCEDURE STATUSDLGSET (POSITION:LONGINT);BEGIN IF OOO000O0II0O <>
NIL THEN OOO000O0II0O ^. SETPERC (POSITION );END ;PROCEDURE STATUSDLGNEWTEXT (CONST S:STRING );BEGIN IF OOO000O0II0O <>
NIL THEN OOO000O0II0O ^. NEWTEXT (S );END ;PROCEDURE SHOWHELPWINDOW (CONST FILENAME:STRING ;HELPCTX:WORD);
VAR OOII:PWINDOW;OI110Ol101OO:PHELPFILE;O1lO0l00O0Ol:PBUFSTREAM;BEGIN O1lO0l00O0Ol := NEW (PBUFSTREAM , INIT (FILENAME ,
STOPENREAD , 1024 ));OI110Ol101OO := NEW (PHELPFILE , INIT (O1lO0l00O0Ol ));IF O1lO0l00O0Ol ^. STATUS =STOK THEN
BEGIN OOII := NEW (PHELPWINDOW , INIT (OI110Ol101OO , HELPCTX ));IF APPLICATION ^. VALIDVIEW (OOII )<> NIL THEN
BEGIN APPLICATION ^. EXECVIEW (OOII );DISPOSE (OOII , DONE );END ;END ELSE BEGIN PRINTERROR (RSGET1 (WORD (O1lO0l00O0Ol
^. STATUS ), LONGINT (@ FILENAME )), HCNOCONTEXT );DISPOSE (OI110Ol101OO , DONE );END ;END ;PROCEDURE VIEWASTEXT
(CONST FILENAME:FNAMESTR);VAR OO1l:PTEXTWINDOW;OO1I:TRECT;BEGIN OO1I.ASSIGN (0 , 0 , 72 , 15 );OO1l := NEW (PTEXTWINDOW ,
INIT (OO1I , FILENAME ));OO1l ^. OPTIONS := OO1l ^. OPTIONS OR OFCENTERED ;DESKTOP ^. INSERT (OO1l );END ;
DESTRUCTOR TPOPUPMENU.DONE ;BEGIN DISPOSEMENU (MENU );INHERITED DONE;END ;CONSTRUCTOR TSPINBUTTON.INIT (VAR BOUNDS:TRECT;
ASTRINGS:PSITEM);BEGIN INHERITED INIT(BOUNDS , ASTRINGS );SETCURSOR (1 , 0 );END ;PROCEDURE TSPINBUTTON.DRAW ;
VAR OI1OllllOl1:TDRAWBUFFER;O10OO0OI1IOO0:WORD;BEGIN IF GETSTATE (SFSELECTED )THEN O10OO0OI1IOO0 := GETCOLOR ($0402 )ELSE
O10OO0OI1IOO0 := GETCOLOR ($0301 );MOVECHAR (OI1OllllOl1 , ' ', LO (O10OO0OI1IOO0 ), SIZE.X );IF SEL < STRINGS.COUNT THEN
MOVECSTR (OI1OllllOl1 , #17+ LEFTJUSTIFY (PSTRING (STRINGS.AT (SEL ))^, SIZE.X )+ #16, O10OO0OI1IOO0 );WRITEBUF (0 , 0 ,
SIZE.X , SIZE.Y , OI1OllllOl1 );END ;PROCEDURE TSPINBUTTON.HANDLEEVENT (VAR EVENT:TEVENT);PROCEDURE OIll1OOI0lI ;
VAR OlI1II0l10:TPOINT;BEGIN IF (EVENT.WHAT AND EVMOUSEDOWN <> 0 )OR (EVENT.WHAT AND EVMOUSEAUTO <> 0 )THEN
BEGIN MAKELOCAL (EVENT.WHERE , OlI1II0l10 );IF OlI1II0l10.X =0 THEN BEGIN IF SEL =0 THEN SEL := STRINGS.COUNT - 1 ELSE
DEC (SEL );END ELSE IF OlI1II0l10.X =SIZE.X - 1 THEN BEGIN IF SEL =STRINGS.COUNT - 1 THEN SEL := 0 ELSE INC (SEL );
END ELSE EXIT ;MOVEDTO (SEL );DRAWVIEW ;CLEAREVENT (EVENT );END ;END ;BEGIN OIll1OOI0lI ;INHERITED HANDLEEVENT(EVENT );
END ;PROCEDURE TXINPUTLINE.HANDLEEVENT (VAR EVENT:TEVENT);PROCEDURE O1OOOOlO1I0l (VAR OI1OllllOl1:PEDITBUFFER;
OII0I11l101,OIlIO0I0lOl:WORD);VAR OI11I0Ol11O:STRING ;BEGIN OI11I0Ol11O := '';IF OIlIO0I0lOl > SIZE.X - 2 THEN
OIlIO0I0lOl := SIZE.X - 2 ;MOVE (OI1OllllOl1 ^[ OII0I11l101 ] , OI11I0Ol11O [ 1 ] , OIlIO0I0lOl );OI11I0Ol11O [ 0 ] :=
CHAR (OIlIO0I0lOl );SETDATA (OI11I0Ol11O );END ;CONST O10100OOllO00='!@#$%^&*()-+=[]{};''`:"~\ ,./|<>?';VAR OO1O:STRING ;
BEGIN INHERITED HANDLEEVENT(EVENT );CASE EVENT.WHAT OF EVKEYBOARD :BEGIN CASE EVENT.KEYCODE OF KBCTRLLEFT :BEGIN IF
SELSTART <> SELEND THEN SELECTALL (FALSE );GETDATA (OO1O );WHILE (CURPOS > 0 )AND (POS (OO1O [ CURPOS ] , O10100OOllO00
)<> 0 ) DO DEC (CURPOS );WHILE (CURPOS > 0 )AND (POS (OO1O [ CURPOS ] , O10100OOllO00 )=0 ) DO DEC (CURPOS );IF CURPOS <
FIRSTPOS THEN DEC (FIRSTPOS , FIRSTPOS - CURPOS );DRAWVIEW ;END ;KBCTRLRIGHT :BEGIN IF SELSTART <> SELEND THEN SELECTALL
(FALSE );GETDATA (OO1O );WHILE (CURPOS < LENGTH (OO1O ))AND (POS (OO1O [ CURPOS + 1 ] , O10100OOllO00 )=0 ) DO INC
(CURPOS );WHILE (CURPOS < LENGTH (OO1O ))AND (POS (OO1O [ CURPOS + 1 ] , O10100OOllO00 )<> 0 ) DO INC (CURPOS );IF CURPOS
> FIRSTPOS + SIZE.X - 2 THEN INC (FIRSTPOS , CURPOS - (SIZE.X - 2 ));DRAWVIEW ;END ;KBSHIFTINS
:BEGIN WITH CLIPBOARD^ DO O1OOOOlO1I0l (BUFFER , BUFPTR (SELSTART ), SELEND - SELSTART );END ;ELSE EXIT ;END ;CLEAREVENT
(EVENT );END ;EVCOMMAND :IF EVENT.COMMAND =CMPASTE THEN WITH CLIPBOARD^ DO O1OOOOlO1I0l (BUFFER , BUFPTR (SELSTART ),
SELEND - SELSTART );END ;END ;CONSTRUCTOR TLISTVIEWER2.INIT (VAR BOUNDS:TRECT;ANUMCOLS:INTEGER;
AHSCROLLBAR,AVSCROLLBAR:PSCROLLBAR);BEGIN INHERITED INIT(BOUNDS , ANUMCOLS , AHSCROLLBAR , AVSCROLLBAR );OPTIONS :=
OPTIONS OR OFPOSTPROCESS ;TYPEDSTR := NEWSTR (SPC (SIZE.X DIV NUMCOLS + 1 ));END ;PROCEDURE TLISTVIEWER2.HANDLEEVENT
(VAR EVENT:TEVENT);VAR O101O01110I1I:WORD;OIlO:INTEGER;BEGIN OIlO := FOCUSED ;INHERITED HANDLEEVENT(EVENT );IF FOCUSED <>
OIlO THEN TYPEDSTRINDEX := 0 ;CASE EVENT.WHAT OF EVCOMMAND :BEGIN CASE EVENT.COMMAND OF CMINSERTITEM , CMBINSERTITEM
:INSERTITEM ;CMDELETEITEM , CMBDELETEITEM :IF FOCUSED < RANGE THEN DELETEITEM ;CMEDITITEM , CMBEDITITEM :IF FOCUSED <
RANGE THEN EDITITEM ;ELSE EXIT ;END ;END ;EVBROADCAST :BEGIN CASE EVENT.COMMAND OF CMRECEIVEDFOCUS :IF EVENT.INFOPTR =@
SELF THEN ENABLECOMMANDS ([ CMINSERTITEM , CMDELETEITEM ] );CMRELEASEDFOCUS :IF EVENT.INFOPTR =@ SELF THEN
DISABLECOMMANDS ([ CMINSERTITEM , CMDELETEITEM ] );ELSE EXIT ;END ;END ;EVKEYBOARD :BEGIN O101O01110I1I := SIZE.X DIV
NUMCOLS + 1 ;IF (EVENT.CHARCODE IN [ #32.. #255] )AND (TYPEDSTRINDEX < O101O01110I1I )THEN BEGIN INC (TYPEDSTRINDEX );
TYPEDSTR ^[ TYPEDSTRINDEX ] := UPCASE (EVENT.CHARCODE );TYPEDSTR ^[ 0 ] := CHR (TYPEDSTRINDEX );FOR OIlO := 0 TO RANGE -
1 DO BEGIN IF UPSTR (COPY (GETTEXT (OIlO , O101O01110I1I ), 1 , TYPEDSTRINDEX ))=TYPEDSTR ^THEN
BEGIN INHERITED FOCUSITEM(OIlO );BREAK ;END ;END ;END ELSE BEGIN CASE EVENT.KEYCODE OF KBDEL , KBBACK :IF TYPEDSTRINDEX
> 0 THEN DEC (TYPEDSTRINDEX );ELSE EXIT ;END ;END ;END ;ELSE EXIT ;END ;IF EVENT.WHAT AND EVBROADCAST =0 THEN CLEAREVENT
(EVENT );END ;PROCEDURE TLISTVIEWER2.INSERTITEM ;BEGIN ABSTRACT ;END ;PROCEDURE TLISTVIEWER2.DELETEITEM ;BEGIN ABSTRACT ;
END ;PROCEDURE TLISTVIEWER2.EDITITEM ;BEGIN ABSTRACT ;END ;CONSTRUCTOR TLISTBOX2.INIT (VAR BOUNDS:TRECT;
ANUMCOLS:INTEGER;AVSCROLLBAR:PSCROLLBAR);BEGIN INHERITED INIT(BOUNDS , ANUMCOLS , AVSCROLLBAR );OPTIONS := OPTIONS OR
OFPOSTPROCESS ;TYPEDSTR := NEWSTR (SPC (SIZE.X DIV NUMCOLS + 1 ));END ;PROCEDURE TLISTBOX2.HANDLEEVENT
(VAR EVENT:TEVENT);VAR O101O01110I1I:WORD;OIlO:INTEGER;BEGIN OIlO := FOCUSED ;INHERITED HANDLEEVENT(EVENT );IF FOCUSED <>
OIlO THEN TYPEDSTRINDEX := 0 ;CASE EVENT.WHAT OF EVCOMMAND :BEGIN CASE EVENT.COMMAND OF CMINSERTITEM , CMBINSERTITEM
:INSERTITEM ;CMDELETEITEM , CMBDELETEITEM :IF FOCUSED < RANGE THEN DELETEITEM ;CMEDITITEM , CMBEDITITEM :IF FOCUSED <
RANGE THEN EDITITEM ;ELSE EXIT ;END ;END ;EVBROADCAST :BEGIN CASE EVENT.COMMAND OF CMRECEIVEDFOCUS :IF EVENT.INFOPTR =@
SELF THEN ENABLECOMMANDS ([ CMINSERTITEM , CMDELETEITEM ] );CMRELEASEDFOCUS :IF EVENT.INFOPTR =@ SELF THEN
DISABLECOMMANDS ([ CMINSERTITEM , CMDELETEITEM ] );ELSE EXIT ;END ;END ;EVKEYBOARD :BEGIN O101O01110I1I := SIZE.X DIV
NUMCOLS + 1 ;IF (EVENT.CHARCODE IN [ #32.. #255] )AND (TYPEDSTRINDEX < O101O01110I1I )THEN BEGIN INC (TYPEDSTRINDEX );
TYPEDSTR ^[ TYPEDSTRINDEX ] := UPCASE (EVENT.CHARCODE );TYPEDSTR ^[ 0 ] := CHR (TYPEDSTRINDEX );FOR OIlO := 0 TO RANGE -
1 DO BEGIN IF UPSTR (COPY (GETTEXT (OIlO , O101O01110I1I ), 1 , TYPEDSTRINDEX ))=TYPEDSTR ^THEN
BEGIN INHERITED FOCUSITEM(OIlO );BREAK ;END ;END ;END ELSE BEGIN CASE EVENT.KEYCODE OF KBDEL , KBBACK :IF TYPEDSTRINDEX
> 0 THEN DEC (TYPEDSTRINDEX );ELSE EXIT ;END ;END ;END ;ELSE EXIT ;END ;IF EVENT.WHAT AND EVBROADCAST =0 THEN CLEAREVENT
(EVENT );END ;PROCEDURE TLISTBOX2.INSERTITEM ;BEGIN ABSTRACT ;END ;PROCEDURE TLISTBOX2.DELETEITEM ;BEGIN ABSTRACT ;END ;
PROCEDURE TLISTBOX2.EDITITEM ;BEGIN ABSTRACT ;END ;PROCEDURE TPARAMINPUTBOX.INSERTITEM ;VAR OO1O:STRING ;BEGIN OO1O :=
'';IF INPUTSTRING ('Parameter', OO1O , 255 , '', HCNOCONTEXT )=CMOK THEN BEGIN LIST ^. ATINSERT (FOCUSED , NEWSTR (OO1O
));SETRANGE (RANGE + 1 );INC (FOCUSED );DRAWVIEW ;END ;END ;PROCEDURE TPARAMINPUTBOX.DELETEITEM ;VAR OO1O:STRING ;
BEGIN IF FOCUSED >= RANGE - 1 THEN EXIT ;IF USERANSWER ('Delete current item?', HCNOCONTEXT )=YES THEN BEGIN LIST ^.
ATFREE (FOCUSED );SETRANGE (RANGE - 1 );DRAWVIEW ;END ;END ;PROCEDURE TPARAMINPUTBOX.EDITITEM ;VAR OO1O:STRING ;BEGIN IF
FOCUSED >= RANGE - 1 THEN EXIT ;OO1O := GETSTR (PSTRING (LIST ^. AT (FOCUSED )));IF INPUTSTRING ('Parameter', OO1O , 255
, '', HCNOCONTEXT )=CMOK THEN BEGIN LIST ^. FREEITEM (LIST ^. AT (FOCUSED ));LIST ^. ATPUT (FOCUSED , NEWSTR (OO1O ));
DRAWVIEW ;END ;END ;PROCEDURE TSTRINGINPUTBOX.INSERTITEM ;VAR OO1O:STRING ;BEGIN OO1O := '';IF INPUTSTRING ('Parameter',
OO1O , 255 , '', HCNOCONTEXT )=CMOK THEN BEGIN LIST ^. INSERT (NEWSTR (OO1O ));SETRANGE (RANGE + 1 );INC (FOCUSED );
DRAWVIEW ;END ;END ;PROCEDURE TSTRINGINPUTBOX.DELETEITEM ;VAR OO1O:STRING ;BEGIN IF USERANSWER ('Delete current item?',
HCNOCONTEXT )=YES THEN BEGIN LIST ^. ATFREE (FOCUSED );SETRANGE (RANGE - 1 );DRAWVIEW ;END ;END ;
PROCEDURE TSTRINGINPUTBOX.EDITITEM ;VAR OO1O:STRING ;BEGIN OO1O := GETSTR (PSTRING (LIST ^. AT (FOCUSED )));IF
INPUTSTRING ('Parameter', OO1O , 255 , '', HCNOCONTEXT )=CMOK THEN BEGIN LIST ^. FREEITEM (LIST ^. AT (FOCUSED ));LIST ^.
INSERT (NEWSTR (OO1O ));DRAWVIEW ;END ;END ;BEGIN BBGUI.PRINTERROR := PRINTERROR ;BBGUI.INFOBOX := INFOBOX ;
BBGUI.USERANSWER := USERANSWER ;END .